﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
   CodeBehind="PersonEditor.aspx.cs" Inherits="Contacts.Web.PersonEditor" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
   
   <script type="text/javascript">
	   $(document).ready(function() {	      
	      $(".datepicker").datepicker(
	      { 
           dateFormat: 'yy-mm-dd', 
	        changeMonth: true, 
	        changeYear: true,
	        yearRange: '1970:2000',
	        defaultDate: '-40y -1m +7d'
           });
	   });
   </script>


        	<h2 class="h2Style">
            The editing form:
            <asp:Label ID="lblCheckGroups" runat="server" Text="" ForeColor="Red"></asp:Label>
            <asp:Label ID="lblPersonID" runat="server" Text=""></asp:Label>
            <asp:Label ID="lblGroupID" runat="server" Text=""></asp:Label>
         </h2>

        	<div id="formSection">

        		<div id="offerForm">

   <asp:ValidationSummary ID="vsLabel" runat="server" ForeColor="Red" 
      DisplayMode="BulletList" ValidationGroup="Requisites" />
   <asp:ValidationSummary ID="ValidationSummary1" runat="server" ForeColor="Red" 
   DisplayMode="BulletList" ValidationGroup="Image" />

   <table border="1" style="margin-left:auto; margin-right:auto; width:60%;">
      <tr>
         <td>
            Имя:
         </td>
         <td style="text-align:left">
            <asp:TextBox ID="ttFirstName" runat="server" ></asp:TextBox>
            <asp:RequiredFieldValidator ID="validFirstName" ForeColor="Red" runat="server" ErrorMessage="Введите имя"
               ControlToValidate="ttFirstName" Display="Dynamic" ValidationGroup="Requisites" >*</asp:RequiredFieldValidator>
            <asp:CustomValidator ID="CustValidFirstNameLength" ForeColor="Red" runat="server" 
               ErrorMessage="Имя должно быть не менее двух символов" 
               onservervalidate="CustValidNameLengthServerValidate" ValidationGroup="Requisites" >*</asp:CustomValidator>
         </td>
         <td rowspan="6">
            <asp:Image ID="imgPhoto" runat="server" Width="140px"/>
         </td>

         
      </tr>
      <tr>
         <td>
            Фамилия:
         </td>
         <td style="text-align:left">
            <asp:TextBox ID="ttLastName" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="validLastName" ForeColor="Red" runat="server" ErrorMessage="Введите фамилию"
               ControlToValidate="ttLastName" ValidationGroup="Requisites" >*</asp:RequiredFieldValidator>
            <asp:CustomValidator ID="CustValidLastNameLength" ForeColor="Red" runat="server" 
               ErrorMessage="Фамилия должна быть не менее двух символов" 
               onservervalidate="CustValidLastNameLengthServerValidate" ValidationGroup="Requisites" >*</asp:CustomValidator>
         </td>
      </tr>
      <tr>
         <td>
            Телефон:<br />
            Пример:
         </td>
         <td style="text-align:left">
            <asp:TextBox ID="ttPhone" runat="server" AutoCompleteType="HomePhone" 
               MaxLength="15" ReadOnly="True"></asp:TextBox>
            <asp:RegularExpressionValidator ID="validPhone" ForeColor="Red" runat="server" ErrorMessage="Введите телефон"
               ControlToValidate="ttPhone" 
               ValidationExpression="((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{2}-\d{2}" 
               ValidationGroup="Requisites">*</asp:RegularExpressionValidator>
            <asp:CustomValidator ID="CustValidPhoneLength" ForeColor="Red" runat="server" 
               ErrorMessage="Телефон должен быть не менее пяти символов" 
               onservervalidate="CustValidPhoneLengthServerValidate" ValidationGroup="Requisites" >*</asp:CustomValidator>
            <br />
            (099) 123-45-67</td>
      </tr>
      <tr>
         <td>
            Email
         </td>
         <td style="text-align:left">
            <asp:TextBox ID="ttEmail" runat="server"></asp:TextBox>
            <asp:RegularExpressionValidator ID="validEmail" ForeColor="Red" runat="server" ErrorMessage="Введённый Email не правельный"
               ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" 
               ControlToValidate="ttEmail" ValidationGroup="Requisites">*</asp:RegularExpressionValidator>
         </td>
      </tr>
      <tr>
         <td>
            ДР
         </td>
         <td style="text-align:left">
            <asp:TextBox ID="ttDatePicker" CssClass="datepicker" runat="server" 
               ReadOnly="False"></asp:TextBox>
         </td>
      </tr>
      <tr>
         <td>
            Группа:
         </td>
         <td>
            <asp:DropDownList ID="ddGroupList" runat="server">
            </asp:DropDownList>
         </td>

      </tr>
      <tr>
         <td>
            Фото:
         </td>
         <td style="text-align:left">
            <asp:FileUpload ID="ImageUpload" runat="server" TabIndex="5" />
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ForeColor="Red" runat="server" 
               ErrorMessage="Картинка не выбрана" ValidationGroup="Image" 
               ControlToValidate="ImageUpload" >*</asp:RequiredFieldValidator>
         </td>
            <td>
               <asp:Label ID="lblNewPhoto" runat="server" Text=""></asp:Label>
            </td>
         
      </tr>
      <tr>
         <td>
            Имя фото:
         </td>
         <td>
            <asp:Label ID="lblPath" runat="server" Text=""></asp:Label>
         </td>
         <td align="center">
            <asp:Button ID="btnSavePhoto" runat="server" Text="Upload" CssClass="aspBtn" 
               Width="70" Height="30"  BorderWidth="1" 
               OnClientClick="return confirm('Вы действительно хотите перезаписать это фото? \n         (Предыдущее фото будет удалено!)')" 
               CommandName="Upload" ValidationGroup="Image" OnClick="BtnSavePhotoClick" 
               TabIndex="3" />
         </td>
      </tr>
      <tr>
         <td align="center" colspan="5">
            <asp:Button ID="btnSave" runat="server" Text="Save" CssClass="aspBtn" Width="70" Height="30"  BorderWidth="1" OnClick="BtnSaveClick" ValidationGroup="Requisites" />
            <asp:Button ID="btnCancel" runat="server" Text="Cancel" CssClass="aspBtn" 
               Width="70" Height="30"  BorderWidth="1" ValidationGroup="Non" TabIndex="2" onclick="BtnCancelClick" />
         </td>
      </tr>
   </table>

				</div>
        	</div><!-- end #formSection -->



</asp:Content>
